var dropDownMenu = 
{
    tag:0,
    knowledgeBase:[
        {
            'name':'汽车、电器',
            'list':[
                ['淘宝商城','http://www.tmall.com/go/chn/tbk_channel/tmall_new.php?pid=mm_29345685_0_0&eventid=101334'],
                ['淘宝特卖','http://www.taobao.com/go/chn/tbk_channel/onsale.php?pid=mm_29345685_0_0&mode=86'],
                ['淘宝女人','http://www.taobao.com/go/chn/tbk_channel/lady.php?pid=mm_29345685_0_0&eventid=101345'],
                ['淘宝男人','http://www.taobao.com/go/chn/tbk_channel/man.php?pid=mm_29345685_0_0&eventid=101330'],
                ['淘宝数码','http://www.taobao.com/go/chn/tbk_channel/digital.php?pid=mm_29345685_0_0&eventid=101332'],
                ['淘宝美容','http://www.taobao.com/go/chn/tbk_channel/beauty.php?pid=mm_29345685_0_0&eventid=101328'],
                ['淘宝机票','http://www.taobao.com/go/chn/tbk_channel/trip.php?pid=mm_29345685_0_0&eventid=101829'],
                ['淘宝台湾馆','http://www.taobao.com/go/chn/tbk_channel/taiwan.php?pid=mm_29345685_0_0&eventid=101350'],
                ['淘宝皇冠店','http://mall.360.cn/static/huangguandian.html']
            ]
        },
        {
            'name':'箱包',
            'list':[
                ['麦包包','http://www.tmall.com/go/chn/tbk_channel/tmall_new.php?pid=mm_29345685_0_0&eventid=101334'],
                ['淘宝特卖','http://www.taobao.com/go/chn/tbk_channel/onsale.php?pid=mm_29345685_0_0&mode=86'],
                ['淘宝女人','http://www.taobao.com/go/chn/tbk_channel/lady.php?pid=mm_29345685_0_0&eventid=101345'],
                ['淘宝男人','http://www.taobao.com/go/chn/tbk_channel/man.php?pid=mm_29345685_0_0&eventid=101330'],
                ['淘宝数码','http://www.taobao.com/go/chn/tbk_channel/digital.php?pid=mm_29345685_0_0&eventid=101332'],
                ['淘宝美容','http://www.taobao.com/go/chn/tbk_channel/beauty.php?pid=mm_29345685_0_0&eventid=101328'],
                ['淘宝机票','http://www.taobao.com/go/chn/tbk_channel/trip.php?pid=mm_29345685_0_0&eventid=101829'],
                ['淘宝台湾馆','http://www.taobao.com/go/chn/tbk_channel/taiwan.php?pid=mm_29345685_0_0&eventid=101350'],
                ['淘宝皇冠店','http://mall.360.cn/static/huangguandian.html']
            ]
        },
    ],
    assembly:function(node)
    {
        var tag = this.tag, dropm = this.menuLayer, data = this.knowledgeBase[tag].list, html = [];
        html.push ( ' <div class="pop_recomment"> <h3>推荐商家</h3> <div class="cont"> ');
        for(var i = 0,len = data.length;i<len;i++)
        {
            var temp = data[i];
            if(temp)
            html.push('<a href="'+temp[1]+'" target="_blank">'+temp[0]+'</a>');
        }
        html.push(' </div> </div>');
        node.append(html.join(''));
    },
    getTagByName:function(name)
    {
        if(typeof name !== 'string') return;
        var data = this.knowledgeBase;
        var j;
        for(var i=0,len=data.length;i<len;i++)
        {
            var temp = data[i];
            if(temp.name == name)
                {
                    j = i;
                    break;
                }
        }
        return j;
    },
    init:function() {
        var topThis = this,timer,timespace = 200;
        var lis = $('#list').find('li');
        var classname = 'hover_trigger';
        lis.mouseover(function(){ 
            lis.removeClass(classname);
            var tag = topThis.getTagByName($.trim($(this).text())); 
            if(typeof tag != 'undefined')
            {
                if(!$(this).hasClass('.cont'))
                {
                    topThis.tag = tag;
                    topThis.assembly($(this));
                }
            }
            $(this).addClass(classname);
        }).mouseout(function(){
                $(this).removeClass(classname);
        });
    }
}
dropDownMenu.init();
